package com.shaoyu.spring.study.validate.annotation;

import com.shaoyu.spring.study.validate.util.ParamType;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * 数据校验
 * @Description:
 * @author: shaoyu1
 * @date: 2019/8/30 16:05
 */
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface ParamValidate {

    String[] groups() default {"default"};

    boolean notNull() default false;

    ParamType type() default ParamType.STRING;

    ParamType childType() default ParamType.STRING;

    String msg() default "Check Parameter Failed!";

    int max() default Integer.MAX_VALUE;

    int min() default Integer.MIN_VALUE;

    String regexp() default "^([\\s\\S]*)$";
    /**
     * 小数点点位
     * @return
     */
    int decimalPlaces() default Integer.MAX_VALUE;

    int length() default Integer.MAX_VALUE;
}
